package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.ReplyDTO;
import com.tianji.learning.query.ReplyPageQuery;
import com.tianji.learning.service.IInteractionReplyService;
import com.tianji.learning.domain.vo.ReplyVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 互动问题的回答或评论 前端控制器
 * </p>
 *
 * @author lcm
 * @since 2023-07-26
 */
@RestController
@RequestMapping("/replies")
@Api(tags = "评论相关接口")
@RequiredArgsConstructor
public class InteractionReplyController {

    private final IInteractionReplyService iInteractionReplyService;

    @PostMapping
    @ApiOperation("新增回答或评论")
    public void addAnswerOrComment(@Valid @RequestBody ReplyDTO replyDTO){
        iInteractionReplyService.addAnswerOrComment(replyDTO);
    }

    @GetMapping("/page")
    @ApiOperation("评论分页查询")
    public PageDTO<ReplyVO> pageComment(@ApiParam("回答评论分页参数") ReplyPageQuery replyPageQuery){
        return iInteractionReplyService.pageComment(replyPageQuery,false);
    }

}
